package com.pangyangyang.elasticsearch.plugin.dispatch;

import com.pangyangyang.elasticsearch.plugin.event.DataModifyEvent;
import com.pangyangyang.elasticsearch.plugin.handler.EventHandler;

/**
 * Created by yangwang on 2015/1/15.
 */
public class EventDispatchTask implements Runnable {

    private DataModifyEvent event;
    private EventHandler handler;

    public EventDispatchTask(DataModifyEvent event, EventHandler handler) {
        this.event = event;
        this.handler = handler;
    }

    @Override
    public void run() {
        if(handler == null){
            return;
        }
        handler.handle(event);
    }
}
